home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
vmed.arc
/
ED8.CCC
< prev
next >
Wrap
Text File
|
1985-12-03
|
3KB
|
157 lines
/* Screen editor: operating system module
*
* Module: ed8/ccc
* Date: November 15, 1983
*
*/
/* all calls to the operating system are made here.
* only this module and the assembler libraries will
* have to be rewritten for a new operating system.
* Made specific to LC libraries - jwk...
*/
#include ed0
/* data global to this module */
#option zvar ON
int ugc; /* keyboard input character */
#option zvar OFF
/* return -1 if no character is ready from the console.
* otherwise, return the character.
*/
syscstat()
{ if (ugc)
return(YES);
else {
ugc = inkey();
return(ugc ? YES : NO);
}
}
/* print character on the console */
syscout(c)
char c;
{
#asm
PUSH HL
LD HL,4
ADD HL,SP
LD A,(HL)
CALL 0033H
POP HL
#endasm
}
/* print character out on printer */
syslout(c)
char c;
{
#asm
PUSH HL
LD HL,4
ADD HL,SP
LD A,(HL)
CALL 003BH
POP HL
#endasm
}
/* open a file */
sysopen(name,mode)
char *name,*mode;
{ FILE *file;
if((file=fopen(name,mode)) == NULL)
return(ERR);
else return(file);
}
/* close file */
sysclose(file)
FILE *file;
{
/* fclose doesn't reliably return OK */
return(fclose(file));
}
/* read next character from a file */
sysrdch(file)
FILE *file;
{ return(getc(file)); }
/* write next character to file */
syspshch(c,file)
char c;
FILE *file;
{ if (putc(c,file) != c)
{
error("disk write failed");
return(ERR);
}
else return(c);
}
/* check file name for syntax */
syschkfn(args)
char *args;
{ while (*args)
*args = toupper(*args++);
return(OK);
}
/* copy file name from args to buffer */
syscopfn(args,buffer)
char *args,*buffer;
{
int n;
n = 0;
while (n < SYSFNMAX-1)
if (args[n] == EOS)
break;
else buffer[n] = args[n++];
buffer[n] = EOS;
}
/* Screen editor: operating system module
* CHANGES ONLY for Module: ed8/ccc
* Changed: February 14, 1984
*/
/* wait for next character from the console.
* do not echo it.
*/
syscin()
{ int temp;
syscout(CURON); /* cursor ON */
while (ugc == 0)
ugc = inkey();
temp = ugc;
if (temp == RTA) /* swap SHIFT-TAB and TAB */
temp = SHRA;
else if (temp == SHRA)
temp = RTA;
ugc = 0;
syscout(CUROFF); /* cursor OFF */
return (temp);
}
/* set cursor -- 02/11/84 addition.
* this version should work with any screen size
* since it always addresses from HOME position!
*/
setcur(x,y) char x,y;
{ syscout(HOME); /* home the cursor for reference */
while (y--)
syscout(CURDN); /* move down to the line */
while (x--)
syscout(CURRT); /* then over to the column */
}
/* end of changes to module ed8/ccc */
/* end module ed8/ccc */